|
TEXTURE OBJECT
This command will texture an object using the specified image.
TEXTURE OBJECT Object Number, Image Number
TEXTURE OBJECT Object Number, Stage Number, Image Number
TEXTURE OBJECT Object Number, Stage Number, Image Number, Ignore Sorting
Object Number
Integer
The object number
Stage Number
Integer
The texture stage index can be provided to the command to specify multi-textures directly
Image Number
Integer
The texture image number
Ignore Sorting
Integer
The NoSort texture flag is a way to group all objects together, sorted by texture
This command does not return a value.
The image can be any size, but the quality of the texture depends on the graphics card used. A texture size to the power of two is recommended size for all your textures. Where an image is larger than the supported texture size, the image is internally reduced when used as a texture. The object and image number must be integer values. You can use this command to remove the effects of multitexturing effects and shaders. An additional texture stage index can be provided to the command to specify multi-textures directly, and is required when using shaders that take pixel data from secondary textures. If an image value of zero is used to texture the object, the texture information will be reset. If the object contains material information from a loading event, this command will erase that material information in favour of a clean texturing of the object. Ensure material settings are applied after the the texture command to retain them, or ensure the object is loaded with both texture and material information pre-set. Setting the parameter NoSort to zero skips the automated resorting of the textures in the render pipeline. The NoSort texture flag is a way to group all objects together, sorted by texture, so that a group of objects can be rendered at the same time, which the graphics engine can do faster than swapping individual textures in and out of graphics memory as it renders all your game objects. Set this value to one to skip the texture sort.
Essentially objects are rendered by texture order, so it will take all the textures at ID=1 and render them first, then all the ones at ID=2 and render those second, and so forth. This is done because it is quicker to render multiple objects that use the same texture than it is to keep swapping textures for each mesh to be rendered. The upshot then is that any objects that use a lower texture ID will be rendered before an object with a higher texture ID.
hide mouse:cls 0:autocam off
ObjectNumber=1
ImageNumber=1
load object "models\model.x",ObjectNumber
load image "iron.jpg",ImageNumber
append object "models\extraanim.x", ObjectNumber, total object frames(ObjectNumber)+1
set object interpolation ObjectNumber,50
position object ObjectNumber,0,0,0
position camera 0,2,4
point camera 0,0,0
set cursor 0,0
texture object ObjectNumber, ImageNumber
while mouseclick()=0:endwhile
if object exist(ObjectNumber)=1 then delete object ObjectNumber
if image exist(ImageNumber)=1 then delete image ImageNumber
end
BASIC3D Commands Menu
Index
|